set hive.exec.dynamic.partition=true;            --  动态分区
set hive.exec.dynamic.partition.mode=nonstrict;
set hive.exec.max.dynamic.partitions=90;         --  每天生成 60 个分区
set hive.exec.max.dynamic.partitions.pernode=90; --  每天生成 60 个分区

insert overwrite table jms_dim.dim_lmdm_sys_second_code_dt partition(dt)
select
    id
    ,code
    ,network_id
    ,network_name
    ,network_code
    ,country_id
    ,province_id
    ,city_id
    ,area_id
    ,town_id
    ,center_id
    ,center_name
    ,center_code
    ,center_province_id
    ,center_city_id
    ,center_area_id
    ,is_enable
    ,is_delete
    ,create_by
    ,update_by
    ,create_by_name
    ,update_by_name
    ,create_time
    ,update_time
    ,version
    ,sort
    ,modified_time
    ,effect_time
    ,invalid_time
    ,'{{ execution_date | cst_ds }}' as dt
from jms_ods.yl_lmdm_sys_second_code
where  is_delete = 1 and dt='{{ execution_date | cst_ds }}'
distribute by 1;